Skip to content

[6.x] Fix chained whereTaxonomyNotIn only excluding entries in all of them - #15868

Merged
jasonvarga merged 2 commits into
statamic:6.xfrom
ryanmitchell:fix-multiple-taxonomy-not-in-wheres
Nov 12, 2026
Merged

jasonvarga merged 2 commits into
statamic:6.xfrom
ryanmitchell:fix-multiple-taxonomy-not-in-wheres

Conversation

@ryanmitchell

Copy link
Copy Markdown
Contributor

When whereTaxonomyNotIn was called more than once on an entry query, the excluded entry ids from each call were intersected. That meant only entries matching every call were excluded.

For example, whereTaxonomyNotIn(['tags::rad'])->whereTaxonomyNotIn(['categories::news']) only excluded entries tagged rad that were also in news. Entries in just one of them were still returned.

The same happens in templates with more than one :not taxonomy parameter, e.g. {{ collection:blog taxonomy:tags:not="rad" taxonomy:categories:not="news" }}.

This PR combines the excluded ids instead, so an entry is excluded if it matches any of the calls. That's consistent with calling whereTaxonomyNotIn once with all the terms.

🤖 Generated with Claude Code

ryanmitchell and others added 2 commits November 12, 2026 12:55
The excluded entry ids from each whereTaxonomyNotIn were intersected,
so chaining them only excluded entries that were in all of them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…not-in-wheres

# Conflicts:
#	tests/Feature/Entries/GetByTaxonomyTermsTest.php
@jasonvarga
jasonvarga merged commit bab874e into statamic:6.x Nov 12, 2026
61 checks passed
@ryanmitchell
ryanmitchell deleted the fix-multiple-taxonomy-not-in-wheres branch November 12, 2026 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants